In [1]:
import bifacial_radiance   
import numpy as np
import pandas as pd
from pathlib import Path
import os
In [2]:
testfolder = str(Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'TestPosts')
if not os.path.exists(testfolder):
    os.makedirs(testfolder)              
In [3]:
demo = bifacial_radiance.RadianceObj('test',path = testfolder)
demo.setGround(0.2)
#epwfile = demo.getEPW(40.0583,-74.4057) # NJ lat/lon 40.0583° N, 74.4057
epwfile = r'EPWs\USA_NJ_McGuire.AFB.724096_TMY3.epw'
metdata = demo.readWeatherFile(epwfile, coerce_year=2021) 
timestamp = metdata.datetime.index(pd.to_datetime('2021-06-17 13:0:0 -5'))
demo.gendaylit(timestamp)  # Use this to simulate only one hour at a time. 
path = C:\Users\sayala\Documents\GitHub\bifacial_radiance\bifacial_radiance\TEMP\TestPosts
Loading albedo, 1 value(s), 0.200 avg
1 nonzero albedo values.
8760 line in WeatherFile. Assuming this is a standard hourly WeatherFile for the year for purposes of saving Gencumulativesky temporary weather files in EPW folder.
Coercing year to 2021
Saving file EPWs\metdata_temp.csv, # points: 8760
Calculating Sun position for Metdata that is right-labeled  with a delta of -30 mins. i.e. 12 is 11:30 sunpos
Out[3]:
'skies\\sky2_40.02_-74.6_2021-06-17_1300.rad'
In [4]:
mymodule=demo.makeModule(name='test_module',x=1,y=2, xgap=0.2, zgap=0.2)
mymodule.addTorquetube(axisofrotation=True, visible=False)
Module Name: test_module
Module test_module updated in module.json
Pre-existing .rad file objects\test_module.rad will be overwritten

Module test_module updated in module.json
Pre-existing .rad file objects\test_module.rad will be overwritten

In [15]:
sceneDict = {'tilt':30,'pitch': 6,'hub_height':1.3,'azimuth':180, 
             'nMods': 13, 'nRows': 2}  

scene = demo.makeScene(module=mymodule, sceneDict=sceneDict) 
In [16]:
demo.__dict__
Out[16]:
{'metdata': <bifacial_radiance.main.MetObj at 0x1b5249ddd00>,
 'data': {},
 'path': 'C:\\Users\\sayala\\Documents\\GitHub\\bifacial_radiance\\bifacial_radiance\\TEMP\\TestPosts',
 'name': 'test',
 'materialfiles': ['materials\\ground.rad'],
 'skyfiles': ['skies\\sky2_40.02_-74.6_2021-06-17_1300.rad'],
 'radfiles': ['objects\\test_module_C_0.92500_rtr_6.00000_tilt_30.00000_13modsx2rows_origin0,0.rad'],
 'octfile': 'test.oct',
 'Wm2Front': 0,
 'Wm2Back': 0,
 'backRatio': 0,
 'nMods': 13,
 'nRows': 2,
 'hpc': False,
 'nowstr': '2022-03-05_124559',
 'basename': 'test',
 'ground': <bifacial_radiance.main.GroundObj at 0x1b5277032e0>,
 'gencumsky_metfile': 'EPWs\\metdata_temp.csv',
 'module': {'x': 1, 'y': 2, 'z': 0.02, 'modulematerial': 'black', 'scenex': 1.2, 'sceney': 2.0, 'scenez': 0.25, 'numpanels': 1, 'bifi': 1, 'text': '! genbox black test_module 1 2 0.02 | xform -t -0.5 -1.0 0.25 -a 1 -t 0 2.0 0', 'modulefile': 'objects\\test_module.rad', 'glass': False, 'offsetfromaxis': 0.25, 'xgap': 0.2, 'ygap': 0.0, 'zgap': 0.2},
 'scene': {'module': {'x': 1, 'y': 2, 'z': 0.02, 'modulematerial': 'black', 'scenex': 1.2, 'sceney': 2.0, 'scenez': 0.25, 'numpanels': 1, 'bifi': 1, 'text': '! genbox black test_module 1 2 0.02 | xform -t -0.5 -1.0 0.25 -a 1 -t 0 2.0 0', 'modulefile': 'objects\\test_module.rad', 'glass': False, 'offsetfromaxis': 0.25, 'xgap': 0.2, 'ygap': 0.0, 'zgap': 0.2}, 'modulefile': 'objects\\test_module.rad', 'hpc': False, 'gcr': 0.3333333333333333, 'text': '!xform -rx 30 -t 0 0 1.3 -a 13 -t 1.2 0 0 -a 2 -t 0 6 0 -i 1 -t -7.199999999999999 -0.0 0 -rz 0 -t 0 0 0 objects\\test_module.rad', 'radfiles': 'objects\\test_module_C_0.92500_rtr_6.00000_tilt_30.00000_13modsx2rows_origin0,0.rad', 'sceneDict': {'tilt': 30, 'pitch': 6, 'hub_height': 1.3, 'azimuth': 180, 'nMods': 13, 'nRows': 2, 'axis_tilt': 0, 'originx': 0, 'originy': 0}},
 'sceneRAD': 'objects\\test_module_C_0.92500_rtr_6.00000_tilt_30.00000_13modsx2rows_origin0,0.rad'}
In [17]:
demo.addPosts()
Postheight! 1.3
Posts Radfile Appended
Posts Created and Appended Successfully.
In [18]:
octfile = demo.makeOct(demo.getfilelist())
Created test.oct
In [19]:
!rvu -vf views\front.vp -e .01 -vp 0.1 -5.4 0.6 -vd 0.0 0.9901 0.1400 test.oct
In [ ]: